#include <ysip2.h>



int main(int argc, char ** argv)
{
	long cbegin = clock();
	ysipInit();
	long cend = clock();


	/*
	cout << "load need " << cend - cbegin << endl;
	string ip;
	cout << "Please enter the ip : " ;
	cin >> ip ;
	cout << endl;

*/

	YSIP2_REGION_INFO_EX regionInfo;
	/*
	int count = 100000000;
	int begin = time(NULL);
	for(int i = 0 ; i < count; i++) 
		ysipGetIpInfo(ip, regionInfo);
	int end = time(NULL);


	cout << " pass : " <<  (end - begin) << endl;
	cout << " avg: " << (count/ (end- begin)) << endl;
*/

	/*
	if(ysipGetIpInfo(ip, regionInfo)) {
		cout << regionInfo << endl;
	}
	*/
	vector<YSIP2_REGION_INFO> vec;
	if(ysipGetRegionChilds(110100, vec)) {
		vector<YSIP2_REGION_INFO>::iterator iter;

		for(iter = vec.begin(); iter < vec.end(); iter ++) {
			cout << *iter << endl;
		}
	}

	/*
	if(ysipGetRegionParents(110000, vec)) {
		vector<YSIP2_REGION_INFO>::iterator iter;

		for(iter = vec.begin(); iter < vec.end(); iter ++) {
			cout << *iter << endl;
		}
	}
	*/

	return 0;
}
